package nix.newfeatures;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class TestForeach {

	/**
	 * 增强for
	 * 
	 * @param args
	 */
	public static void main(String[] args) {

		List<String> list = new ArrayList<String>();
		list.add("aa");
		list.add("bb");
		list.add("cc");

		// 增强for
		for (String str : list) {
			System.out.println(str);
		}
		System.out.println("------------------");
		// 迭代器
		Iterator it = list.iterator();
		while (it.hasNext()) {
			String str = (String) it.next();
			System.out.println(str);
		}
	}

}
